﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Universe.VectorImage.Demo1
{
    using System.Drawing.Drawing2D;
    using Lab;

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.Paint += This_OnPaint;
            this.Resize += (sender, args) => Invalidate();
        }


        private void This_OnPaint(object sender, PaintEventArgs e)
        {
            // e.Graphics.ResetTransform();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            var sz = this.ClientSize;
            e.Graphics.FillRectangle(SystemBrushes.Window, 0,0,sz.Width, sz.Height);
            var img = Signs2Image.Image;
            float sx = 1f*(sz.Width-2)/img.Bounds.Right;
            float sy = 1f*(sz.Height-2)/img.Bounds.Bottom;
            e.Graphics.ScaleTransform(sx, sy);
            Pen p = new Pen(Color.Black, 0.1f);
            var path = Renderer.GetGraphicsPath(img.Lines);
            // Renderer.Render(e.Graphics, img.Lines, p);
            e.Graphics.FillPath(new SolidBrush(Color.Silver), path);
            e.Graphics.DrawPath(p, path);
        }
    }
}
